<!DOCTYPE html>
<html xmlns:th="http://www.w3.org/1999/xhtml">
<head th:include="common_include :: commonHead('密码修改')"/>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <form class="form-horizontal m" id="form-user-edit" th:object="${user}">
                <input type="hidden" name="rowKey" id="rowKey" th:field="*{rowKey}"/>
                <div class="form-group">
                    <label class="col-sm-3 control-label">账号</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="text" name="userAccount" id="userAccount" readonly="true" th:field="*{userAccount}">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-3 control-label">密码</label>
                    <div class="col-sm-8">
                        <input class="form-control" type="password" name="userPass" id="userPass">
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
<div th:include="common_include :: commonFoot"/>
<script type="text/javascript">
    var prefix = ctx + "upms/user"

    $("#form-user-edit").validate({
        rules: {
            userPass: {
                required: true,
                minlength: 6,
                maxlength: 20
            },
        },
        messages: {
            userPass: {
                required: "请输入新密码",
                minlength: "密码不能小于6个字符",
                maxlength: "密码不能大于20个字符"
            },
        },
        submitHandler: function (form) {
            $.operate.save(prefix + "/updatePassword", $('#form-user-edit').serialize());
        }
    });

    function submitClick() {
        if ($('#form-user-edit').valid()) {
            $('#form-user-edit').submit()
        }
    }
</script>
</body>
</html>
